-
Notifications
You must be signed in to change notification settings - Fork 121
[Local Catalog] Update full/incremental sync to have consistent interface #16187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…`shouldPerform*Sync` as private.
…c interface to be consistent.
|
|
joshheald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, I tried on an iPad Air with iOS 18. A suggestion inline about removing the forceSync parameter – take it or leave it though...
Also some tests need renaming
| func shouldPerformFullSync(for siteID: Int64, maxAge: TimeInterval) async -> Bool | ||
| /// - forceSync: Whether to bypass age checks and always sync | ||
| /// - Throws: POSCatalogSyncError.syncAlreadyInProgress if a sync is already running for this site | ||
| func performFullSyncIfApplicable(for siteID: Int64, maxAge: TimeInterval, forceSync: Bool) async throws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you anticipate forceSync doing more than bypassing age checks? If not, perhaps we can just pass maxAge: 0 when we want to force it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion - nope, it's just used to skip the age check now. In 149167f, I removed this parameter and added non-negative maxAge validation and only fetch last incremental date from database for age check for positive maxAge in shouldPerformIncrementalSync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a few of the old test names need to be updated from shouldPerformFullSync to performFullSync here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I went through the test cases and renamed them in 149167f.

Fixes WOOMOB-1333
Description
This PR refactors the
POSCatalogSyncCoordinatorto ensure consistency between full and incremental sync interface and implementations by introducing privateshouldPerform*Synchelper methods for both sync types.Discussion ref: #16117 (comment)
Key Changes:
shouldPerformFullSyncmethod to encapsulate sync decision logic for full syncsshouldPerformIncrementalSyncprivate and consistent with full sync patternperformFullSyncIfApplicableandperformIncrementalSyncIfApplicableto acceptmaxAgeandforceSyncparametersmaxIncrementalSyncAgeproperty in favor of passingmaxAgeas a parameterperformFullSyncandperformIncrementalSyncthat call the main methods with default parameterssiteID,maxAge, andforceSyncBenefits:
Steps to reproduce
Local Catalog is behind a local feature flag enabled in debug builds. No behavior changes are expected, a confidence testing would be helpful:
POSCatalogSyncCoordinatormessages in the console, they should match the full sync statusRefresh catalogto trigger a full sync --> after the full sync, the sync info should be up-to-dateTesting information
I tested for POS stores in iPad A16 iOS 26.0 simulator:
RELEASE-NOTES.txtif necessary.